partitioning a line segment